<template>
    <div v-if="arr.length!=0" class="cywh">
        <Topbar/>
        <img :src="this.arr[2].slider[0].backgroundImage1" alt="">
        <div class="box">
             <Pz v-for="(v,i) in arrb" 
            :key="i" 
            :cakeimage="v.cakeimage" 
            :cakename="v.cakename" 
            :cakeprice="v.cakeprice" 
            :cakeoriginal="v.cakeoriginal" 
            :goodsid="v.goodsid" 
            :cakeingredients="v.cakeingredients"
            />
        </div>
            
    </div>
</template>

<script>
import {getlink} from "@/api/getapi.js"
import Pz from "@/components/ddgHD/popularzi.vue"
import Topbar from "@/components/ddgHD/topbar.vue"
export default {
    components:{
        Pz,
        Topbar
    },
    
    data(){
        return {
            arr:[],
            arrb:[]
        }
    },
    mounted() {
        getlink("/data/ddg").then((ok)=>{
            this.arr=ok.data.data
        })
    },
    created(){
        getlink("http://180.76.121.47:8008/cake").then((ok)=>{
            ok.data.data.forEach((el)=>{
                if(el.typeid==1004){
                    this.arrb.push(el)
                }
            })
        })
    }
}
</script>

<style scoped>
    .cywh{
        font-size: 0.12rem;
    }
    img{
        width: 100%;
        vertical-align: middle;
    }
    .box{
        display: flex;
        justify-content: space-evenly;
        flex-wrap: wrap;
    }
    .nav{
        background-color: white;
        width: 90%;
        height: 0.3rem;
        border: 2px solid red;
        margin: 0 auto;
        line-height: 0.3rem;
        padding: 0.1rem;
       
    }
    .nav>a>span{
        padding: 0.1rem 0.2rem;
    }
    .nav>a{
        color: #212121;
    }
    .nav a.router-link-exact-active {
        color: white;
        display: inline-block;
        width: 33%;
        background-color: red;
    }
</style>